package com.kuang.lesson01;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class Test {
    public static void main(String[] args) {
        Frame frame = new Frame();
        frame.setSize(400,300);
        frame.setLocation(300,400);
        frame.setVisible(true);
        Panel p1 = new Panel();
        Panel p2 = new Panel();
        Panel p3 = new Panel();
        frame.add(p1,BorderLayout.WEST);
        frame.add(p2,BorderLayout.EAST);
        frame.add(p3,BorderLayout.CENTER);
        p1.setLayout(new GridLayout(2,1));
        p1.add(new Button("west-1"));
        p1.add(new Button("west-2"));
        p2.setLayout(new GridLayout(2,1));
        p2.add(new Button("east-2"));
        p2.add(new Button("east-2"));
        p3.setLayout(new GridLayout(2,1));
        Panel p4 = new Panel();
        Panel p5 = new Panel();
        p3.add(p4);
        p3.add(p5);
        p4.setLayout(new GridLayout(2,1));
        p4.add(new Button("bt1"));
        p4.add(new Button("bt2"));
        p5.setLayout(new GridLayout(2,2));
        for (int i = 0; i < 4; i++) {
            p5.add(new Button("p5-btn"+i));

        }
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });



    }
}
